package com.ruoyi.custom.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.custom.mapper.StoreProductRuleMapper;
import com.ruoyi.custom.domain.StoreProductRule;
import com.ruoyi.custom.service.IStoreProductRuleService;

/**
 * 商品规则值(规格)Service业务层处理
 * 
 * @author xking
 * @date 2022-08-03
 */
@Service
public class StoreProductRuleServiceImpl implements IStoreProductRuleService 
{
    @Autowired
    private StoreProductRuleMapper storeProductRuleMapper;

    /**
     * 查询商品规则值(规格)
     * 
     * @param id 商品规则值(规格)主键
     * @return 商品规则值(规格)
     */
    @Override
    public StoreProductRule selectStoreProductRuleById(Long id)
    {
        return storeProductRuleMapper.selectStoreProductRuleById(id);
    }

    /**
     * 查询商品规则值(规格)列表
     * 
     * @param storeProductRule 商品规则值(规格)
     * @return 商品规则值(规格)
     */
    @Override
    public List<StoreProductRule> selectStoreProductRuleList(StoreProductRule storeProductRule)
    {
        return storeProductRuleMapper.selectStoreProductRuleList(storeProductRule);
    }

    /**
     * 新增商品规则值(规格)
     * 
     * @param storeProductRule 商品规则值(规格)
     * @return 结果
     */
    @Override
    public int insertStoreProductRule(StoreProductRule storeProductRule)
    {
        storeProductRule.setCreateTime(DateUtils.getNowDate());
        return storeProductRuleMapper.insertStoreProductRule(storeProductRule);
    }

    /**
     * 修改商品规则值(规格)
     * 
     * @param storeProductRule 商品规则值(规格)
     * @return 结果
     */
    @Override
    public int updateStoreProductRule(StoreProductRule storeProductRule)
    {
        storeProductRule.setUpdateTime(DateUtils.getNowDate());
        return storeProductRuleMapper.updateStoreProductRule(storeProductRule);
    }

    /**
     * 批量删除商品规则值(规格)
     * 
     * @param ids 需要删除的商品规则值(规格)主键
     * @return 结果
     */
    @Override
    public int deleteStoreProductRuleByIds(Long[] ids)
    {
        return storeProductRuleMapper.deleteStoreProductRuleByIds(ids);
    }

    /**
     * 删除商品规则值(规格)信息
     * 
     * @param id 商品规则值(规格)主键
     * @return 结果
     */
    @Override
    public int deleteStoreProductRuleById(Long id)
    {
        return storeProductRuleMapper.deleteStoreProductRuleById(id);
    }
}
